package com.thread;

public class Test_2{
    public static void main(String[] args) {
        Thread thread = new Thread(new Dog());
        thread.start();
        Thread thread1 = new Thread(new Person());
        thread1.start();
        System.out.println(thread1.getState());
        for(int i=0;i<50;i++){
            System.out.println("啦啦啦"+i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}


class Dog implements Runnable{
    @Override
    public void run() {
        int count2=0;
        while(true){
            System.out.println("哈哈哈哈~"+(++count2));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            if(count2==50){
                break;
            }
        }
    }
}

class Person implements Runnable{

    @Override
    public void run() {
        int count=0;
        while(true){
            System.out.println("喜欢你是我的秘密~"+(++count));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            if(count==50){
                break;
            }
        }
    }
}
